<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
 <head>
  <title>inputEx - MultiSelectField Usage</title>

<!-- YUI CSS -->
<link rel="stylesheet" type="text/css" href="../lib/yui/reset-fonts/reset-fonts.css">
<link rel="stylesheet" type="text/css" href="../lib/yui/container/assets/container.css"> 
<link rel="stylesheet" type="text/css" href="../lib/yui/assets/skins/sam/skin.css">

<!-- InputEx CSS -->
<link type='text/css' rel='stylesheet' href='../css/inputEx.css' />

<!-- Demo CSS -->
<link rel="stylesheet" type="text/css" href="css/demo.css"/>
<link rel="stylesheet" type="text/css" href="css/dpSyntaxHighlighter.css">

 </head>

 <body>

<h1>inputEx - MultiSelectField Usage</h1>


<!-- YUI Library -->
<script type="text/javascript" src="../lib/yui/utilities/utilities.js"></script>

<!-- Just for the example (not needed by MultiSelectField)-->
<script type="text/javascript" src="../lib/yui/json/json-min.js"></script>

<!-- InputEx -->
<script src="../js/inputex.js"  type='text/javascript'></script>
<script src="../js/mixins/choice.js"  type='text/javascript'></script>
<script src="../js/Field.js"  type='text/javascript'></script>
<script src="../js/fields/StringField.js"  type='text/javascript'></script>
<script src="../js/fields/SelectField.js"  type='text/javascript'></script>
<script src="../js/widgets/ddlist.js"  type='text/javascript'></script>
<script src="../js/fields/MultiSelectField.js"  type='text/javascript'></script>


<script src="js/dpSyntaxHighlighter.js"></script>
<script src="inputex-examples.js"></script>




<!-- Example 1 -->
<div class='exampleDiv'>
 <h2>Basic MultiSelectField creation</h2>
 <p>Use the following code to create a basic inputEx MultiSelectField. The first value of "options" is used as the invite text to select an option.</p>
 <div class='demoContainer' id='container1'></div>
 <div class='codeContainer'>
  <textarea name="code" class="JScript">
		var ms = new inputEx.MultiSelectField({
			label: 'Javascript libraries you use', 
			name: 'country', 
			choices: [{ value: 'Choose a library' }, { value: 'YUI' }, { value: 'Dojo' }, { value: 'Prototype' }, { value: 'Scriptaculous'}, { value: 'Mootools' }],
			parentEl: 'container1', 
			description: 'Select and order your favorite libraries'
		});
		ms.updatedEvt.subscribe(function(e,params) {
			var value = YAHOO.lang.JSON.stringify(params[0]);
			YAHOO.util.Dom.get('container1').appendChild( inputEx.cn('div',null,null,"Updated at "+(new Date())+" "+value) );
		});
  </textarea>
 </div>
</div>




<!-- Example 2 -->
<div class='exampleDiv'>
 <h2>Change returned values</h2>
 <p>As SelectField, MultiSelect field allow to set the labels for the options</p>
 <div class='demoContainer' id='container2'></div>
 <div class='codeContainer'>
  <textarea name="code" class="JScript">
		var ms = new inputEx.MultiSelectField({
			label: 'Javascript libraries you use',
			name: 'country',
			choices: [
				{ value: null, label: 'Choose a library' },
				{ value: 'yui', label: 'YUI' },
				{ value: 'dojo', label: 'Dojo' },
				{ value: 'prototype', label: 'Prototype' },
				{ value: 'scriptaculous', label: 'Scriptaculous'},
				{ value: 'mootools', label: 'Mootools' }
			],
			parentEl: 'container2',
			description: 'Select and order your favorite libraries'
		});
		ms.updatedEvt.subscribe(function(e,params) {
			var value = YAHOO.lang.JSON.stringify(params[0]);
			YAHOO.util.Dom.get('container2').appendChild( inputEx.cn('div',null,null,"Updated at "+(new Date())+" "+value) );
		});
  </textarea>
 </div>
</div>


 </body>
</html>